<?php
error_reporting(0);
header("Content-type: text/html; charset=utf-8");
session_start();
require_once 'common/config.php';
require_once 'common/conn.php';
require_once 'common/function.php';
require_once 'db/account.db.php';
require_once 'db/item.db.php';
require_once 'db/itemType.db.php';
require_once 'db/accountMoney.db.php';
require_once 'db/friend.db.php';
require_once 'db/character.db.php';

//sprintf(param,"user_id=%s&user_pw=%s", g_BravoMain.m_cLoginID, g_BravoMain.m_cLoginPassMD5);//,pMsg->m_byErrStr, pMsg->m_byPhoneNumber);
//echo md5("123456");
$accountId = isset($_GET['GLuser_acc']) ? strval($_GET['GLuser_acc']) : "";
$job = isset($_GET['job']) ? strval($_GET['job']) : "";//玩家职业
$alljob = isset($_GET['alljob']) ? strval($_GET['alljob']) : "";//展示所有 默认0 不展示全部 1展示全部
if ($accountId == "") {
	$accountId = isset($_POST['GLuser_acc']) ? strval($_POST['GLuser_acc']) : "";
}
$accountPass = isset($_GET['GLuser_pwd']) ? strval($_GET['GLuser_pwd']) : "";
if ($accountPass == "") {
	$accountPass = isset($_POST['GLuser_pwd']) ? strval($_POST['GLuser_pwd']) : "";
}

if ($job == "") {
	$job = isset($_POST['job']) ? strval($_POST['job']) : "";
}
if($job == "")
{
	$job = -1;
}

if($alljob == 1 )
{
	$xjob =-1;
}else
{
	//echo $job.'<br />';
	if($job != 0 && $job != 4 )
	{
		$yyjob = getAlljob($job);
		$xjob = $yyjob;
	}else
	{
		$xjob = $job;
	}
	//$xjob = $yyjob;
	//echo $xjob.'aaaaaa';
	//var_dump($xjob);
}
/*
  $key = isset($_GET['key']) ? strval($_GET['key']) : "";
  if ($key == "") {
  $key = isset($_POST['key']) ? strval($_POST['key']) : "";
  }
  if ($key != "Glmall0119") {
  return;
  }
*/
/*
  $paperDB = "paper3";
  $tgameDB = "BBGame_Test";
*/
$paperDB = "GL_paper_01";
$tgameDB = "GL_GameDB_01";
/*
  error_reporting(E_ALL);
  ini_set('display_errors', '1');
  ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); //将出错信息输出到一个文本文件
*/
$dbc = new DBC();
$balance = 0;
//余额
$accountDb = new AccountDb($dbc);
$user = $accountDb->getAccountByAccountId($accountId);
if (isArrayNotEmpty($user)) {
	$pass = trim($user[0]['AccountPass']);
	$md5 = md5($pass);
	//echo " accountPass=[".$accountPass."]   pass=[".$pass."]  md5=[".$md5."]";
	if ($accountPass != $pass) {
		return;
	}
	$_SESSION['AccUnique'] = $user[0]['AccUnique'];
	$_SESSION['AccountID'] = $user[0]['AccountID'];
	if (isset($_SESSION['AccountID']) && $_SESSION['AccountID'] != "") {
		$accountMoneyDb = new AccountMoneyDb($dbc);
		$accountMoney = $accountMoneyDb->getAccountMoney($_SESSION['AccUnique']);
		if ($accountMoney && isArrayNotEmpty($accountMoney)) {
			$balance = $accountMoney[0]['Balance'];
		}
	}
}
$itemDb = new ItemDb($dbc);
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
$adjacents = isset($_GET['adjacents']) ? intval($_GET['adjacents']) : 0;
if ($page <= 0) {
	$page = 1;
}
if ($adjacents <= 0) {
	$adjacents = 4;
}
$limit = 50;
$start = ($page - 1) * $limit;
if (isset($_GET['type'])) {
	$type = intval($_GET['type']);
} else {
	$type = 1;
}
$data = $itemDb->getItem($type, $start, $limit,$xjob);
$itemTypeDb = new ItemTypeDb($dbc);
$itemTypeArray = $itemTypeDb->getItemType();
$numberOfObject = $itemDb->getItemNumber($type);
$dbc2 = new DBC($paperDB);
$friendDb = new FriendDb($dbc2);
//file_put_contents("txt2.txt","11111111111111111111111111");
$friends = $friendDb->getFriendByAccount($_SESSION['AccUnique']);
//file_put_contents("txt.txt", json_encode($friends));
$friends_count = $friends ? count($friends) : 0;
$dbc3 = new DBC($tgameDB);
$characterDb = new CharacterDb($dbc3);
//echo 'aaaaa->'.$job;
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title><?php echo TITLE;
?></title>
        <link rel="stylesheet" href="./css/main.css">
		<link rel="stylesheet" href="css/dist/css/layui.css">
		<script src="css/dist/layui.js"></script>
        <!--[if lt IE 9]>
        <script src="js/html5shiv.min.js"></script>
        <script src="js/respond.min.js"></script>
        <![endif]-->
		<script>
		/*
function change_check(){
	var alljob = <?php 
	if ($alljob == "")
	{
		$alljob=0;
	}
	echo $alljob; ?>;

	if(alljob == 0)
	{
		//document.getElementById('cs1').style.background='#ddde959e';document.getElementById('cs2').style.color='#999';
	}else{
		//document.getElementById('cs2').style.background='#ddde959e';document.getElementById('cs1').style.color='#999';
	}
};
*/
</script>
    </head>
    <body>
        <div class="container">
            <div class="product_nav">
                <div class="dianshu">
                    <span class="dianshu_num">荣币：<span id="balance_show"><?php echo $balance;
?></span></span>
                    <!--<a href="http://new.shoukabao.cn/Payment/Service/ab68f07b19732d558922c58b00b36545" target="_blank" class="chongzhi_btn">在线充值</a>-->
					<a href="javascript:void(0)" class="chongzhi_btn" onclick="testgo();">在线充值</a>
                </div>
                <a href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=1&job=<?php echo $job;  ?>&alljob=<?php echo $alljob; ?>" class="nav_btn"><i class="nav_icon"></i>最新商品</a>
                <a href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=2&job=<?php echo $job;  ?>&alljob=<?php echo $alljob; ?>" class="nav_btn"><i class="nav_icon"></i>角色时装</a>
                <a href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=3&job=<?php echo $job;  ?>&alljob=<?php echo $alljob; ?>" class="nav_btn"><i class="nav_icon"></i>坐骑装备</a>
                <a href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=4&job=<?php echo $job;  ?>&alljob=<?php echo $alljob; ?>" class="nav_btn"><i class="nav_icon"></i>功能道具</a>
                <a href="special.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=5&job=<?php echo $job;  ?>&alljob=<?php echo $alljob; ?>" class="nav_btn"><i class="nav_icon"></i>每日专区</a>
				<span class="layui-breadcrumb" lay-separator="-">
					<a href="javascript:void(0)"><font color="black">商品展示(点击选择):</font></a>

					<a id="cs1" href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=<?php echo $_GET['type']; ?>&job=<?php echo $job;  ?>&alljob=0">当前职业:<font color="#ff5e0e"><?php echo 
					$jobname = getJobName($job);
					$jobname; ?></font>(仅显示可用道具)</a>

					<a id="cs2" href="store.php?GLuser_acc=<?php echo $accountId; ?>&GLuser_pwd=<?php echo $accountPass; ?>&type=<?php echo $_GET['type']; ?>&job=<?php echo $job; ?>&alljob=1"><font color="green">所有职业</font></a>

				</span>
            </div>
			<script>
//注意：导航 依赖 element 模块，否则无法进行功能性操作
layui.use('element', function(){
  var element = layui.element;
  
  //…
});
</script>

            <div class="product_list">
                <?php
$imageUrl = "http://itemmall.qx680.com:8888/store/";
for ($i = 0;$i < count($data);$i++) {
	$name = trim($data[$i]['ItemName']);
	$time_jieshao = trim($data[$i]['time_jieshao']);
	$alt = trim($data[$i]['alt']);
	$name = mb_convert_encoding($name, "UTF-8", "GBK");
	$time_jieshao = iconv("GBK", "UTF-8", $time_jieshao);
	$alt = iconv("GBK", "UTF-8", $alt);
	$dengji = iconv("GBK", "UTF-8", trim($data[$i]['dengji']));
	$wuligongji =iconv("GBK", "UTF-8", trim($data[$i]['wuligongji']));
	$mofagongji =iconv("GBK", "UTF-8", trim($data[$i]['mofagongji']));
	$wulifangyu =iconv("GBK", "UTF-8", trim($data[$i]['wulifangyu']));
	$mofafangyu =iconv("GBK", "UTF-8", trim($data[$i]['mofafangyu']));
	$mingzhong =iconv("GBK", "UTF-8", trim($data[$i]['mingzhong']));
	$huibi =iconv("GBK", "UTF-8", trim($data[$i]['huibi']));
	$liliang =iconv("GBK", "UTF-8", trim($data[$i]['liliang']));
	$minjie =iconv("GBK", "UTF-8", trim($data[$i]['minjie']));
	$zhihui =iconv("GBK", "UTF-8", trim($data[$i]['zhihui']));
	$hp = iconv("GBK", "UTF-8", trim($data[$i]['hp']));
	$mp = iconv("GBK", "UTF-8", trim($data[$i]['mp']));
	$type = trim($data[$i]['Type']);
	?>
		                    <div class="product_item">
		                        <div class="product_img_box">
		                            <img class="goods_hqid" data_id="<?php echo $i; ?>" id="image_<?php echo $i; ?>" src="<?php echo $imageUrl . $data[$i]['ImageUrl']; ?>"
									title = "<?php echo $alt; ?>"
									onclick="readxq(<?php echo $i; ?>,'<?php echo $dengji; ?>','<?php echo $wuligongji; ?>','<?php echo $mofagongji; ?>','<?php echo $wulifangyu; ?>','<?php echo $mofafangyu; ?>','<?php echo $mingzhong; ?>','<?php echo $huibi; ?>','<?php echo $liliang; ?>','<?php echo $minjie; ?>','<?php echo $zhihui; ?>','<?php echo $hp; ?>','<?php echo $mp; ?>','<?php echo $type; ?>');">
									<input type="hidden" id="number_xq" value=""/>
		                            <input type="hidden" id="item_<?php echo $i; ?>" value="<?php echo $data[$i]['ItemNo']; ?>" />
		                            <input type="hidden" id="idx_<?php echo $i; ?>" value="<?php echo $data[$i]['id_x']; ?>" />
		                            <input type="hidden" id="alt_<?php echo $i; ?>" value="<?php echo $alt; ?>" />
		                        </div>
								
		                        <div class="product_introl">
		                            <div class="detail_introl" id="name_<?php echo $i; ?>" data_value = "<?php echo $name;
	?>"><?php echo $name;
	?></div>
		                            <div class="product_props">
		                                <a href="javascript:void(0)" id="jieshao_<?php echo $i; ?>"><?php echo $time_jieshao;
	?></a>
		                                <a href="javascript:void(0)"><span id="price_<?php echo $i; ?>" data_value = "<?php echo $data[$i]['Price'];
	?>"><?php echo $data[$i]['Price'];
	?></span>荣币</a>
		                            </div>
		                            <div class="product_ctrl">
		                                <a href="javascript:void(0)" class="give" onclick="gift_send(<?php echo $i; ?>)">赠送</a>
		                                <a href="javascript:void(0)" class="buy" onclick="buy_sdj(<?php echo $i; ?>)">购买</a>
		                            </div>
		                        </div>
		                    </div>
		                <?php
		} ?>
		            </div>
		        </div>
				<script>//

				</script>
		        <div class="div_overlay" id="modal_div">
		            <div id="popupdiv"  class="popupdiv zengsong">
		                <div class="dialog_body">
		                    <div class="dialog_header">
		                        <p class="title_link"><img src="./images/arrow.png" alt="">购买道具</p>
		                        <span class="close_key"><img src="./images/close_caret.png" alt="" onclick="close_div()"></span>
		                    </div>
		                    <div class="dialog_content">
		                        <div class="product_detail">
		                            <div class="product_img_wrapper">
		                                <img class="product_img" id="current_image" src="" alt=""><!--这个是商品的渲染图片标签-->
		                                <input type="hidden" id="current_item" value="" />
		                                <input type="hidden" id="current_idx" value="" />
		                                <input type="hidden" id="current_price" value="" />
		                            </div>
		                            <div class="detail_introl_wrapper">
		                                <div><span clas="name_label">名称</span><span class="name_value" id="current_name"></span></div>
		                                <div class="detail_introl_txt" id="current_alt">
		                                </div>
		                            </div>
		                        </div>
		                        <div class="btn_group">
		                            <a href="javascript:void(0)" class="show_day"><span id="current_jieshao"></span><span id="show_price"></span> 荣币</a>
		                            <a href="javascript:void(0)" class="cancel" onclick="close_div()">取消</a>
		                            <a href="javascript:void(0)" class="confirm" onclick="confirm_buy()" id="confirm_button">确认赠送</a>
		                        </div>
		                    </div>
		                </div>
		                <div class="friends_list" id="select_div">
		                    <div class="friends_list_header">
		                        <img src="./images/user.png" alt="">赠送好友
		                    </div>
		                    <ul class="friends_list_ul">
		                        <!--<li onselect="selectli(this)" onclick="">ss</li>-->
		                        <?php
		for ($i = 0, $len = count($friends);$i < $len;$i++) {
		// $friends[$i]['FriendName'] = mb_convert_encoding(trim($friends[$i]['FriendName']), "UTF-8", "GBK");
		$name = trim($friends[$i]['FriendName']);
		$characters = $characterDb->getCharacterByName($name);
		if (count($characters) > 0) {
			$name = mb_convert_encoding($name, "UTF-8", "GBK");
			//echo "<option value='" . $characters[0]['AccountUnique'] . "'>$name</option>";
			echo "<li  onclick=\"selectli(this)\" onselect=\"selectli(this)\" id=\"" . $characters[0]['AccountUnique'] . "\">" . $name . "</li>";
		}
	}
	?>
		                    </ul>
		                </div>
		            </div>
		        </div>
		        <!--
		        <div class="div_overlay" id="modal_div">
		            <div class="product_item" style="margin: 25% 25%; background-color: wheat; opacity: 1.0;filter:Alpha(opacity=100);">
		                <div class="product_img_box" style="margin: 20px;">
		                    <img  id="current_image" src="" alt="">
		                    <input type="hidden" id="current_item" value="" />
		                    <input type="hidden" id="current_idx" value="" />
		                </div>
		                <div class="product_introl">
		                    <div class="detail_introl" id="current_name"><?php echo $name;
	?></div>
		                    <div class="product_props">
		                        <a href="javascript:void(0)">半年</a>
		                        <a href="javascript:void(0)" id="current_price">点数</a>
		                    </div>
		                    <div class="product_ctrl">
		                        <a href="javascript:void(0)" class="give" onclick="close_div()">取消</a>
		                        <a href="javascript:void(0)" class="buy" onclick="confirm_buy()">确定</a>
		                    </div>
		                </div>
		                <div id="select_div" class="product_introl">
		                    <select id="friend_id" size="10" style="width:200px;">
		        <?php
		for ($i = 0, $len = count($friends);$i < $len;$i++) {
		// $friends[$i]['FriendName'] = mb_convert_encoding(trim($friends[$i]['FriendName']), "UTF-8", "GBK");
		$name = trim($friends[$i]['FriendName']);
		$characters = $characterDb->getCharacterByName($name);
		if (count($characters) > 0) {
			$name = mb_convert_encoding($name, "UTF-8", "GBK");
			// echo "<option value='" . $characters[0]['AccountUnique'] . "'>$name</option>";
		}
	}
	?>
		                    </select>
		                </div>
		            </div>
		        </div>
		        -->
		    </body>
		    <script src="./js/jquery-1.11.3.js"></script>
		    <script src="./js/layer.js"></script>
		    <script>
		                                $(function() {
		$(document).ready(function() {
			$(document).bind("contextmenu", function(e) {
				return false;
			}
			);
		}
		);
				                                    $('.product_list>.product_item:nth-child(3n+1)').css({
				                                        //   marginLeft: '0'
		});
	}
	);
	</script>
		    <script>
		        function testgo() {
		layer.msg('平台原因,充值系统维护,需充值联系管理员QQ:719079746,比例1:12,单次多充有送.', {icon: 2, time: 500000, offset: ['150px', '300px'], btn: ['确认'], btnAlign: 'c'});
		//layer.msg('你赠送的道具已发送至朋友的右下角 MY ITEM，请提醒他查收',5);
	}
	</script>
		    <!--<script type="text/javascript" src="js/jquery.js"></script>-->
		    <script type="text/javascript">
		        var buy = true;
				//购买确认框
	function buy_sdj(index) {
		$(".popupdiv").removeClass("zengsong").addClass("goumai");
		document.getElementById("modal_div").style.display = "block";
		document.getElementById("select_div").style.display = "none";
		document.getElementById("current_image").src = document.getElementById("image_" + index).src;
		document.getElementById("current_name").innerHTML = document.getElementById("name_" + index).innerHTML;
		document.getElementById("show_price").innerHTML = "售价 : " + document.getElementById("price_" + index).innerHTML;
		document.getElementById("current_price").value = document.getElementById("price_" + index).innerHTML;
		document.getElementById("current_item").value = document.getElementById("item_" + index).value;
		document.getElementById("current_idx").value = document.getElementById("idx_" + index).value;
		//document.getElementById("current_jieshao").innerHTML = document.getElementById("jieshao_" + index).innerHTML;
		document.getElementById("current_alt").innerHTML = document.getElementById("alt_" + index).value;
		document.getElementById("confirm_button").innerHTML = "确定购买";
		buy = true;
	}
//////////////////////////////////////////////////

				//这里点击图片查看详情了
/*  hove 触发 闪动BUG未解决
	$(document).ready(function(){
		
		var cs = 0;
		$(".goods_hqid").hover(function(){
				if( cs > 0){
						return false;
					};
				var id =  $(this).attr("data_id");
				console.log(id);
				cs = cs + 1
				readxq(id);
			}
		 );
		$(".goods_hqid").mouseleave(function(){
			if (cs == 1)
			{
				setTimeout(test(),100000)
			}
				//layer.closeAll();
				cs = 0;
			}
		);
		function test()
				{
				 alert('1');
				}
		 
		/*
		var id =  $(this).attr("data_id");
		 $(id).hover(function(){
			 console.log(id);
			 $(id).css("background-color","black");
			},function(){
				
		$(id).css("background-color","pink");
		 });
		 
	});
*/
	function readxq(index_goods,dengji,wuligongji,mofagongji,wulifangyu,mofafangyu,mingzhong,huibi,liliang,minjie,zhihui,hp,mp,type){
		//document.getElementById("number_xq").value = index_goods;
		//console.log(document.getElementById("number_xq").value);
		var goods_jieshao1 = document.getElementById("alt_"+index_goods).value;
		var goods_image1 = document.getElementById("image_"+index_goods).src;
		var goods_name1 = document.getElementById("name_"+index_goods).getAttribute("data_value");
		var goods_price1 = document.getElementById("price_"+index_goods).getAttribute("data_value");
		if ( type != 2 )
		{
			return false;
		}
		//console.log("name_"+index_goods);
		layer.config({
			extend: 'mycss/main.css', //加载您的扩展样式
			skin: 'tm_class'
				});
		//layer.alert('layer皮肤-Yourskin');
		layer.open({
				  type: 1
				,skin:'tm_class'
				 ,title: [goods_name1 + ' - 详细信息','background-color:#8bc34a'] //不显示标题栏
				,closeBtn: false
				,offset: ['40px', '250px']
				,area: ['360px','500px']
				 ,shade: 0.8
				,id: 'LAY_layuipro' //设定一个id，防止重复弹出
				,resize: false
				,btn: ['购买','赠送','关闭']
				//点击回调
				,yes: function(index, layero){
				//事件
						//console.log(index)
						layer.close(index);
						buy_sdj(index_goods);
					}
				,btn2: function(index, layero){
				//按钮【按钮二】的回调
						layer.close(index);
						gift_send(index_goods);
					 }
/////////////////////////
				,btnAlign: 'c'
				,moveType: 1 //拖拽模式，0或者1
				,content: 
				'<div id="tm_class"><div style = "text-align:left;padding-left:10px;float:left;width:120px;"><img src="'+goods_image1+'"></div>'+
				'<div style="float:left;width:230px;height:87px;text-align:center;line-height:87px">'+goods_name1+'</div>'+
				'<p style="padding-left:8px"><font color = "	#FF7F50">售价 :</font> <font color="green">'+goods_price1+'</font> <font color = "#FF7F50">荣币</font></p>'+
				'<div style="float:left;width:150px;padding-left:8px"><p id="item_name">职业:人类</p>'+
				'<p>所需等级 : '+dengji+'</p>'+
				'<p>物理攻击 : '+wuligongji+'</p>'+
				'<p>物理防御 : '+wulifangyu+'</p>'+
				'<p>魔法攻击 : '+mofagongji+'</p>'+
				'<p>魔法防御 : '+mofafangyu+'</p>'+
				'<p>命中值   : '+mingzhong+'</p>'+
				'<p>回避值   : '+huibi+'</p>'+
				'<p>力量     : '+liliang+'</p>'+
				'<p>敏捷     : '+minjie+'</p>'+
				'<p>智力     : '+zhihui+'</p>'+
				'<p>HP增加量 : '+hp+'</p>'+
				'<p>MP增加量 : '+mp+'</p>'+
				'</div>'+
				'<div style="float:left;width:200px;line-height:18px;"><font style ="padding-left:10px;display:block;padding-top:10px;" size="2px;">详细介绍:<br>'+goods_jieshao1+'</font></br></div>'+
				'</div>'

		});
	}
///////////////////////////////////
/////////////////////



//赠送模块
	var haopengyou = "";
	function confirm_buy() {
		var price = document.getElementById("current_price").value;
		var itemNo = document.getElementById("current_item").value;
		var id_x = document.getElementById("current_idx").value;
		if (buy) {
			haopengyou = "";
		} else {
			//                var oSelect = document.getElementById('friend_id');
			//                var index = oSelect.selectedIndex;   //option数组返回的同时会返回当前option的选中下标selectedIndex
			//                var haopengyou = oSelect[index].value;
		}
		$.ajax({
				                type: "POST",
				                url: "api/cart.php",
				                dataType: "json",
				                data: {
				                    action: 'confirmBuy',
				                    price: price,
				                    itemNo: itemNo,
				                    id_x: id_x,
				                    buy: buy,
				                    haoyou: haopengyou
				                },
				                success: function(data) {
			if (data.code == 0) {
				if (buy) {
					//                            alert("购买成功");
					//layer.msg('购买成功,请从右下角MY ITEM提取', 5);
					layer.msg('您购买的道具已发送至右下角 MY ITEM', {icon: 1, time: 500000, offset: ['150px', '300px'], btn: ['知道了'], btnAlign: 'c'});
				} else {
					//                            alert("赠送成功");
					//layer.msg('赠送成功', 5);
					layer.msg('赠送成功,已发送至好友MY ITEM', {icon: 1, time: 500000, offset: ['150px', '300px'], btn: ['知道了'], btnAlign: 'c'});
				}
				document.getElementById("modal_div").style.display = "none";
								                        document.getElementById("balance_show").innerHTML = data.balance;
								                    } else {
								//                        alert(data.msg);
				layer.msg(data.msg, {icon: 2, time: 500000, offset: ['150px', '300px'], btn: ['知道了'], btnAlign: 'c'});
								                        document.getElementById("modal_div").style.display = "none";
								                    }
								                },
								                error: function(error, ab, cd) {
					console.log(error);
				}
			}
			);
		}
		function gift_send(index) {
			<?php if ($friends_count > 0) {
				?>
								                $(".popupdiv").removeClass("goumai").addClass("zengsong");
				document.getElementById("modal_div").style.display = "block";
				document.getElementById("select_div").style.display = "block";
				document.getElementById("current_image").src = document.getElementById("image_" + index).src;
				document.getElementById("current_name").innerHTML = document.getElementById("name_" + index).innerHTML;
				document.getElementById("show_price").innerHTML = "售价 : " + document.getElementById("price_" + index).innerHTML;
				document.getElementById("current_price").value = document.getElementById("price_" + index).innerHTML;
				document.getElementById("current_item").value = document.getElementById("item_" + index).value;
				document.getElementById("current_idx").value = document.getElementById("idx_" + index).value;
				//document.getElementById("current_jieshao").innerHTML = document.getElementById("jieshao_" + index).innerHTML;
				document.getElementById("current_alt").innerHTML = document.getElementById("alt_" + index).value;
				document.getElementById("confirm_button").innerHTML = "确定赠送";
				buy = false;
				<?php
			} else {
				?>
								                layer.msg('你暂时没有好友', {icon: 2, time: 500000, offset: ['150px', '300px'], btn: ['知道了'], btnAlign: 'c'});
				<?php
			}
			?>
			/*
             layer.msg("即将开通，敬请期待", 5);*/
		}
		function close_div() {
			document.getElementById("modal_div").style.display = "none";
		}
		function selectli(e) {
			var lis = document.getElementsByTagName("li");
			for (var i = 0; i < lis.length; i++) {
				lis[i].className = "";
			}
			e.className = "selected";
			haopengyou = e.id;
		}
		</script>
				</html>